package com.huyanqi.service.impl;


import java.util.List;

import javax.annotation.Resource;
import javax.jws.WebService;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.huyanqi.core.service.impl.BaseFrontServiceImpl;
import com.huyanqi.dao.UserDAO;
import com.huyanqi.entity.User;
import com.huyanqi.service.UserService;

@Service("UserService")
@Transactional
@WebService(endpointInterface="com.huyanqi.service.UserService")
public class UserServiceImpl extends BaseFrontServiceImpl<User, Long, UserDAO> implements UserService {

	@Resource(name="UserDAO")
	@Override
	public void setEntityDao(UserDAO entityDao) {
		this.entityDao = entityDao;
	}
	
	@Override
	public List<User> getAllUser() {
		return entityDao.executeQuery("select u from User u", -1,-1);
	}

	@Override
	public String regUser(User u) {
		try{
			entityDao.saveEntity(u);
			return "注册成功";
		}catch (Exception e) {
			e.printStackTrace();
			return "注册出错";
		}
	}


}
